#!/usr/bin/python2.5
import code
import getpass
import sys,os

homedir = os.path.expanduser('~')
google_base_path = os.path.join(homedir, 'google_appengine')

sys.path.append(google_base_path)

from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db

def auth_func():
  #return raw_input('Username:'), getpass.getpass('Password:')
  return 'xiaojay@gmail.com', '604115'
   
if len(sys.argv) < 2:
  print "Usage: %s app_id [host]" % (sys.argv[0],)
app_id = sys.argv[1]
if len(sys.argv) > 2:
  host = sys.argv[2]
else:
  host = '%s.appspot.com' % app_id

#we use a helper function provided by remote_api 
#   to set up the environment to send all datastore requests to the remote datastore

remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host)

#code.interact('App Engine interactive console for %s' % (app_id,), None, locals())
'''
from IPython.Shell import IPShellEmbed 
ipshell = IPShellEmbed(
                       banner = 'App Engine interactive console for %s' % (app_id,),
                       rc_override=locals())
ipshell()
'''
